<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <script>
    //if else
    var a = 3
    if (a == 1) {
      console.log('a=1');
    } else if (a == 2) {
      console.log('a=2');
    } else if (a == 3) {
      console.log('a=3')
    } else {
      console.log('a不是1 2 3')
    }


    // switch
    switch (a) {
      case 1:
        console.log('a=1');
        break;
      case 2:
        console.log('a=2');
        break;
      case 3:
        console.log('a=3');
        break;
      default:
        console.log('a不是1 2 3');
        break;
    }
  </script>
</body>

</html>